package com.hfi.mymap;

import com.hfi.dao.EmployeeMapper;

import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author ChangLiang
 * @date 2019/5/20
 */
public class BootStrap {

    private static final Map<Method, MyMapperMethod> methodCache = new ConcurrentHashMap<>();

    public static void main(String[] args) {

        Class clazz = EmployeeMapper.class;
        EmployeeMapper mapper = (EmployeeMapper) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz},
                new MyMapperProxy<>(clazz,
                        methodCache));
        mapper.getEmpByMyIdAndLastName(1, "tom");
    }
}
